/*
 * @Description:
 * @Version: 2.0
 * @Autor: zhaoyu
 * @Date: 2021-04-17 10:02:05
 * @LastEditors: zhaoyu
 * @param:
 * @return:
 * @author: zhaoyu
 */

import { observable, action } from "mobx";

class AppStore {
  @observable time = "122";
  @observable todos = [];

  // 这些方法也可以在组件中去写，但是作为协同开发，应该需要在一起进行维护
  @action addTodo(todo) {
    this.todos.push(todo);
  }

  @action deleteTodo() {
    this.todos.pop();
  }

  @action resetTodo() {
    this.todos = [];
  }
}

const store = new AppStore();

export default store;
